import React, {useState} from 'react'
import Child from './Child';
const Parent = () => {
    const [count, setCount] = useState(0);
    const [name, setName] = useState('hello');
    console.log('render Parent')
    return (
        <div>
        <div>当前值: {count}</div>
        <button onClick={() => setCount(c => c+1)}>数字加一</button>
        <br/>
        <button onClick={() => setName('world')}>改变名称</button>
        <Child name={name}/>
        </div>
    )
}

export default Parent